<?php

/**
 * Created by PhpStorm.
 * User: home
 * Date: 2019/2/23
 * Time: 0:24
 */
class Student
{
    //自我介绍
    private function intro()
    {
        echo "大家好 我是学生!";
    }
    protected function eat(){
        echo "正在吃东西";
    }

    public function hello(){
        $this->intro(); // 自身可以调用private
    }
}

final class LittleStudent extends Student
{
    //重写父类方法
    public function hello()
    {
        parent::eat(); // 调用父类 protected
    }
}
$xiao_ming = new LittleStudent();
$xiao_ming->hello();//只能调用public